package com.member.common.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @author 李鑫晨
 * 是否上下架
 */
@Getter
public enum UpDownShelvesEnum {
    /**
     * 上架
     */
    GROUNDING(0, "上架"),

    /**
     * 下架
     */
    OFF_SHELF(1, "下架"),
    ;

    private final Integer key;
    private final String desc;

    UpDownShelvesEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static UpDownShelvesEnum getByKey(Integer key) {
        for (UpDownShelvesEnum item : UpDownShelvesEnum.values()) {
            if (Objects.equals(item.getKey(), key)) {
                return item;
            }
        }
        return null;
    }

}
